﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TesteOnline.Model
{
    public class Avaliation
    {
        public Avaliation()
        {
            Questions = new Dictionary<int,Question>();
        }
        
        public Dictionary<int, Question> Questions { set; get; }

        public Summary GetSummary()
        {
            Summary sumamry = new Summary();
            foreach (KeyValuePair<int, Question> kvp in Questions)
            {
                if (kvp.Value.Result == 1)
                {
                    sumamry.Correct++;
                }
                else if ( kvp.Value.Result == 0)
                {
                    sumamry.Blank++;
                }
                else if (kvp.Value.Result == -1)
                {
                    sumamry.Wrongs++;
                }
            }
            return sumamry;
        }
    }
}